/**   
* @Title: BeanMapUtil.java 
* @Package com.jd.framework.orm.util 
* @Description: TODO(用一句话描述该文件做什么) 
* @author liubing1@jd.com	   
* @date 2014-5-6 下午11:17:13 
* @version V1.0   
*/ 
package com.jd.orm.framework.core.util;

import java.util.Map;

import net.sf.cglib.beans.BeanMap;

/**
 * @author liubing1@jd.com
 *
 */
public class BeanMapUtil {
	/**
	 * javabean transform map
	* <p>Title: </p> 
	* <p>Description: </p> 
	* @param object
	* @return
	 */
	public static Map convertBeanToMap(Object object){
		Map beanmap = BeanMap.create(object);
		return beanmap;
	}
	/**
	 * Map transform javabean
	* <p>Title: </p> 
	* <p>Description: </p> 
	* @param object
	* @param map
	* @return
	 */
	public static Object convertMapToBean(Object object,Map<String, Object> map){
		Map beanmap = BeanMap.create(object);
		for(String key:map.keySet()){
			if(beanmap.containsKey(key)){
				beanmap.put(key, map.get(key));
			}
		}
		return object;
		
	}
}
